/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.vfi.be;

import edu.upn.sigemfi.rec.be.CuotaCredito;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Alex
 */
@Entity
@Table(name = "VFI_PAGO_CREDITO")
@NamedQueries({@NamedQuery(name = "PagoCredito.findAll", query = "SELECT p FROM PagoCredito p"), @NamedQuery(name = "PagoCredito.findByIdPagoCredito", query = "SELECT p FROM PagoCredito p WHERE p.idPagoCredito = :idPagoCredito"), @NamedQuery(name = "PagoCredito.findByMonto", query = "SELECT p FROM PagoCredito p WHERE p.monto = :monto"), @NamedQuery(name = "PagoCredito.findByMora", query = "SELECT p FROM PagoCredito p WHERE p.mora = :mora")})
public class PagoCredito implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_PAGO_CREDITO")
    private Long idPagoCredito;
    @Column(name = "MONTO")
    private BigDecimal monto;
    @Column(name = "MORA")
    private BigDecimal mora;
    @OneToMany(mappedBy = "fidVfiPagoCredito", fetch = FetchType.LAZY)
    private List<TranFinanciera> tranFinancieraCollection;
    //relacion con rec
    @JoinColumn(name = "FID_REC_CUOTA_CREDITO", referencedColumnName = "ID_CUOTA_CREDITO")
    @ManyToOne(fetch = FetchType.LAZY)
    private CuotaCredito fidRecCuotaCredito;

    public PagoCredito() {
    }

    public PagoCredito(Long idPagoCredito) {
        this.idPagoCredito = idPagoCredito;
    }

    public Long getIdPagoCredito() {
        return idPagoCredito;
    }

    public void setIdPagoCredito(Long idPagoCredito) {
        this.idPagoCredito = idPagoCredito;
    }

    public BigDecimal getMonto() {
        return monto;
    }

    public void setMonto(BigDecimal monto) {
        this.monto = monto;
    }

    public BigDecimal getMora() {
        return mora;
    }

    public void setMora(BigDecimal mora) {
        this.mora = mora;
    }

    public List<TranFinanciera> getTranFinancieraCollection() {
        return tranFinancieraCollection;
    }

    public void setTranFinancieraCollection(List<TranFinanciera> tranFinancieraCollection) {
        this.tranFinancieraCollection = tranFinancieraCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPagoCredito != null ? idPagoCredito.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PagoCredito)) {
            return false;
        }
        PagoCredito other = (PagoCredito) object;
        if ((this.idPagoCredito == null && other.idPagoCredito != null) || (this.idPagoCredito != null && !this.idPagoCredito.equals(other.idPagoCredito))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.PagoCredito[idPagoCredito=" + idPagoCredito + "]";
    }

    /**
     * @return the fidRecCuotaCredito
     */
    public CuotaCredito getFidRecCuotaCredito() {
        return fidRecCuotaCredito;
    }

    /**
     * @param fidRecCuotaCredito the fidRecCuotaCredito to set
     */
    public void setFidRecCuotaCredito(CuotaCredito fidRecCuotaCredito) {
        this.fidRecCuotaCredito = fidRecCuotaCredito;
    }
}
